import { defineStore } from 'pinia';
import { ref } from 'vue';
import type { CommandSender } from '../commandHelper';

type SendTestCmd = CommandSender<any, any> | null;

// 1. 先按原来的方式定义Store（完全不变）
export const useTestStore = defineStore('testInjection', () => {
  const sendTestCmd = ref<SendTestCmd>(null);

  const setInjections = (injections: { sendTestCmd?: SendTestCmd }) => {
    if (injections.sendTestCmd) {
      sendTestCmd.value = injections.sendTestCmd;
    }
  };

  const taskId = ref("");
  const setInitData = (data: { taskId: string }) => {
    taskId.value = data.taskId;
  };

  return { sendTestCmd, setInjections, setInitData, taskId };

});